package com.guochenglang.www.dao;

import com.guochenglang.www.pojo.Files;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface FilesDao {
    /**
     * 附件搜索
     *
     * @param files 附件条件
     * @return 附件信息列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Files> filesSelect(Files files) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 分页搜索附件
     *
     * @param page  当前页码
     * @param num   每页显示个数
     * @param files 搜索条件
     * @param order 排序条件
     * @param mode  升序还是降序
     * @return 附件列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Files> filesSelectByLimit(int page, int num, Files files, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 添加附件
     *
     * @param files 附件信息
     * @return 添加的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int insertFiles(Files files) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 更新附件
     *
     * @param set        更新信息
     * @param conditions 更新条件
     * @return 更新行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int updateFiles(Files set, Files conditions) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 删除附件
     *
     * @param conditions 删除条件
     * @return 删除行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int deleteFiles(Files conditions) throws SQLException, InterruptedException, IllegalAccessException;
}
